<!--
 * @Author: 花香蝶自来 1026583651@qq.com
 * @Date: 2024-04-16 18:35:31
 * @LastEditors: 花香蝶自来 1026583651@qq.com
 * @LastEditTime: 2024-05-28 19:43:53
 * @FilePath: /crm/components/formz/components/formselect.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
	<view class="">
		<u-form-item :label="item.label" borderBottom ref="item1" :prop="item.value">
			<!-- <view @click="tap" style="flex: 1">{{ inputValue }}</view> -->
			<view
			   @click="show = true"
					 style="flex: 1"
			  :class="[
			    value ? 'uni-input-input' : 'select-wrap',
			  ]"
			  >{{ inputValue }}</view>
		</u-form-item>
		<u-datetime-picker :show="show" v-model="pickervalue" mode="datetime" @confirm="select"></u-datetime-picker>
	</view>
</template>

<script>
	export default {
		props: {
			item: {
				typeof: Object,
				default: () => {
					return {};
				},
			},
			data: {
				typeof: Object,
				default: () => {
					return {};
				},
			},
			value: {
				typeof: [String, Number, Boolean, Array, Object],
				default: () => {
					return "";
				},
			},
		},
		data() {
			return {
				value1: (new Date()).getTime(),
				// inputValue: "",
				show: false,
				params: {
					year: true,
					month: true,
					day: true,
					hour: false,
					minute: false,
					second: false,
					// 选择时间的时间戳
					timestamp: true,
				}
			};
		},
		computed: {

			pickervalue: {
				get() {
					return this.$z.timefn.getdateTime(this.value)
				},
				set() {

				}
			},
			inputValue() {
				if (this.value == "" || !this.value || this.value == "undefined") {
					return "请选择"
				}
				return this.value
			},
		},

		methods: {
			tap() {
				this.show = true
			},
			blur() {
				this.$emit("input", this.inputValue);
			},
			select(e) {
				this.$emit("input", uni.$u.timeFormat(e.value, "yyyy-mm-dd hh:MM:ss"));
				this.show = false;
				console.log(e, "111");
			},
		},
	};
</script>

<style scoped lang="scss">
  .uni-forms-item {
    margin-bottom: 0!important;
    border-bottom: 1rpx solid #E9EBEC;
    &:last-child {
      border-bottom: none;
    }
  }
  .uni-input-input,.uni-easyinput__content-input{
	font-size: 14px!important;
	color: #171A1D!important;
	line-height: 99rpx!important;
	height: 99rpx!important; 
	padding-left: 10px;
  }
 .uni-forms-item__label {
   margin-left: 0;
   font-size: 14px!important;
   color: #171A1D!important;
   line-height: 99rpx!important;
   height: 99rpx!important;
 }
 .select-wrap {
   color:#C1C5C9;
   font-size:14px;
   line-height: 99rpx!important;
   height: 99rpx!important;
   padding-left: 10px;
 }
</style>